package com.software.loginregister.api;

import com.software.loginregister.entity.Result;
import com.software.loginregister.entity.vo.FoodRecognitionDTO;
import com.software.loginregister.entity.vo.ImageFoodGroupVO;
import com.software.loginregister.entity.vo.RefrigeratorFoodVO;

import java.util.List;

import okhttp3.MultipartBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface RefrigeratorApi {
    @GET("api/refrigerator-foods/list")
    Call<Result<List<ImageFoodGroupVO>>> getFoodList(@Query("userId") Long userId);

    // 删除食物
    @DELETE("api/refrigerator-foods/{foodId}")
    Call<Result<String>> deleteFood(
            @Path("foodId") Long foodId,
            @Query("userId") Long userId
    );

    @POST("/api/refrigerator-foods/add/{userId}")
    Call<Result<String>> addFoodsToFridge(
            @Path("userId") Long userId,
            @Body List<FoodRecognitionDTO> foods
    );

    // 删除父项图片 
    @DELETE("/api/image/delete/{id}")
    Call<Result<String>> deleteImage(@Path("id") Long id);

    @Multipart
    @POST("/api/refrigerator-foods/upload-image/{foodId}")
    Call<Result<String>> uploadFoodImage(@Path("foodId") Long foodId, @Part MultipartBody.Part file);
}